package cc.vv.btpartyjob.partymanager.activity

import cc.vv.baselibrary.bean.base.BaseResponseObj
import cc.vv.baselibrary.view.BaseTopBarView
import cc.vv.btpartyjob.jnimodule.server.OperationServer
import cc.vv.btpartyjob.partymanager.delegate.ManagerBaseBinder
import cc.vv.btpartyjob.partymanager.delegate.SheHuiZuZhiDetailActivityDelegate
import cc.vv.btpartyjob.partymanager.moudel.resp.GetZzDetailResponseObj
import cc.vv.btpartyjob.partymanager.server.PartyManagerServer
import cc.vv.mvp.activity.BaseActivityMVP
import cc.vv.mvp.binder.BaseDataBinder

/**
 * 社会组织详情详情详情
 * Created by Chen.qi on 2018/10/25.
 */
class SheHuiZuZhiDetailActivity : BaseActivityMVP<SheHuiZuZhiDetailActivityDelegate>() {

    override fun initData() {
        viewDelegate?.setTopBarTitle("组织详情")
        val id = intent.getStringExtra("id")
        PartyManagerServer.getSheHuiZuZhiDetail(id)
    }

    override fun bindEvenListener() {
        viewDelegate?.setTitleBackBtnOnClick(object : BaseTopBarView.EventInterface {
            //返回
            override fun leftOnClick() {
                finish()
            }

            override fun leftCloseClick() {}
            override fun rightOnClick() {

            }
        })
    }

    override fun getDelegateClass(): Class<SheHuiZuZhiDetailActivityDelegate> {
        return SheHuiZuZhiDetailActivityDelegate::class.java
    }

    override fun getDataBinder(): BaseDataBinder<*, *> {
        return ManagerBaseBinder()
    }

    override fun getData(obj: BaseResponseObj<*>?) {
        super.getData(obj)
        when (obj) {
            is GetZzDetailResponseObj -> {
                //社会组织详情
                val data = obj.data
                viewDelegate?.setZuZhiName(data?.orgName)
                viewDelegate?.setZuZhiCreateTime(OperationServer.formatStr(data?.createTime))
                viewDelegate?.setFuZeRenName(data?.principal)
                viewDelegate?.setFuZeRenTel(data?.mobile)
                viewDelegate?.setWebViewContentZz(data?.introduction)
            }
        }
    }
}